<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">File</f:facet>

       <s:decorate id="title" template="layout/display.xhtml">
           <ui:define name="label">title</ui:define>
           #{fileHome.instance.title}
       </s:decorate>

       <s:decorate id="creationDate" template="layout/display.xhtml">
           <ui:define name="label">creationDate</ui:define>
           #{fileHome.instance.creationDate}
       </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/FileEdit.xhtml" 
                    id="edit" 
                 value="Edit"/>

        <s:button view="/#{empty fileFrom ? 'FileList' : fileFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

   <rich:tabPanel switchType="ajax">

   <rich:tab label="author">
   <div class="association" id="authorParent">

       <h:outputText value="No author"
                  rendered="#{fileHome.instance.author == null}"/>

       <rich:dataTable var="user"
                  value="#{fileHome.instance.author}"
               rendered="#{fileHome.instance.author != null}"
             rowClasses="rvgRowOne,rvgRowTwo"
                     id="authorTable">
           <h:column>
               <f:facet name="header">id</f:facet>
               #{user.id}
           </h:column>
           <h:column>
               <f:facet name="header">username</f:facet>
               #{user.username}
           </h:column>
           <h:column>
               <f:facet name="header">password</f:facet>
               #{user.password}
           </h:column>
           <h:column>
               <f:facet name="header">name</f:facet>
               #{user.name}
           </h:column>
           <h:column>
               <f:facet name="header">action</f:facet>
               <s:link id="viewuser"
                    value="View"
                     view="/User.xhtml">
                   <f:param name="userId"
                          value="#{user.id}"/>
               </s:link>
           </h:column>
       </rich:dataTable>

   </div>
   </rich:tab>
  </rich:tabPanel>

</ui:define>

</ui:composition>
